﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using BusinessLayer;
using System.Reflection;
using System.IO;
using BusinessLayer.Model.Entities;
using System.Configuration;

namespace DataAccess
{
    public class IntecDataContext : DataContext
    {
        private static readonly string _mappingsFile = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetAssembly(typeof(DataAccess.IntecDataContext)).CodeBase).Path)) + "\\Mapping.xml";

        public IntecDataContext()
            : base(ConfigurationSettings.AppSettings["ConnectionString"], 
                                XmlMappingSource.FromUrl(_mappingsFile))
        { }
    }
}
